package com.hl.mapper;

import com.hl.pojo.Psychologicalassessments;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface XinlicepingMapper {

    public List<Psychologicalassessments> XinlicepingListAll();
    /*心里测评以及问答查询传输给后端平台*/
    List<Psychologicalassessments> xinicepingandall();
    /*新增测评*/
    @Insert("insert into psychologicalassessments (id,psychological_content,psychological_img) values (#{id},#{name},#{url})")
    int insertxinli(@Param("id") Integer id,@Param("name") String name, @Param("url") String url);
    /*新增问答*/
    @Insert("insert into testquestions (question_name,psychological_assessment_id,question_summary) values (#{name},#{id},#{answer})")
    int insertwenda(@Param("name") String name,@Param("id") Integer id,@Param("answer") String answer);

    /*删除测评*/
    @Delete("delete from psychologicalassessments where id = #{id}")
    int deleteceping(Integer id);
    /*删除问答*/
    @Delete("delete from testquestions where id = #{id}")
    int deletewenda(Integer id);
    /*修改测评*/
    @Update("update psychologicalassessments set psychological_content = #{name} where id = #{id}")
    int updateceping(@Param("id") Integer id,@Param("name") String name);
}
